import os from 'os';
import configTool from '../../com/configTool';

const {machineId, machineIdSync} = require('node-machine-id');


async function getServerInfo() {
    await configTool.init();


    return {
        'arch': os.arch(),
        'PCName': os.hostname(),
        'memorySize': Math.ceil(os.totalmem() / 1024 / 1024 / 1024) + 'GB',
        'operatingSystem': os.type(),
        'CPU': os.cpus()[0].model + ' X ' + os.cpus().length,
        'machineId': machineIdSync({original: true}),
        'software': {
            name: configTool.baseConfig.name,
            version: configTool.baseConfig.version,
            protocol: configTool.baseConfig.protocol,
            localIPAddress: configTool.baseConfig.localIPAddress,
            proxyAfterProxy_IPAddress: configTool.baseConfig.proxyAfterProxy_IPAddress
        }
    };
}


export default getServerInfo;
